package patterns.observePattern;

public abstract class Observed {
	public MobileServerData mobileServerData;
	public String name;
	private boolean couldPush;

	public final void checkUpdate() throws Exception {
		if (!getCouldPush()) {
			throw new Exception("Observed " + getName() + " is not bind to any rigester");
		}
	}

	public abstract void update(ObservedMessage observedMessage) throws Exception;
public void pushToRigester(){
	
}
	public void deleteRigester() throws Exception {
		mobileServerData.deleteObserved(this);
		setCouldPush(false);
		this.mobileServerData = null;
	}

	public boolean isCouldPush() {
		return couldPush;
	}

	public void setCouldPush(boolean couldPush) {
		this.couldPush = couldPush;
	}

	public boolean getCouldPush() {
		return this.couldPush;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
